<h2>DESCRIPTION</h2>

<em>v.univar</em> calculates univariate statistics on (by default) an attribute
of, or, through the <b>-d</b> flag on distance between, vector map features.
Attributes are read per feature and per category value. This means that if the 
map contains several features with the same category value, the attribute is 
read as many times as there are features. On the other hand, if a feature has 
more than one category value, each attribute value linked to each of the 
category values of the feature is read. For statistics on one attribute 
per category value, instead of one attribute per feature and per category,
see <a href="v.db.univar.html">v.db.univar</a>.

<p>Extended statistics (<b>-e</b>) adds median, 1st and 3rd quartiles, and 90th
percentile to the output.

<h2>NOTES</h2>

When using the <b>-d</b> flag, univariate statistics of distances 
between vector features are calculated. The distances from all features 
to all other features are used. Since the distance from feature A to 
feature B is the same like the distance from feature B to feature A, 
that distance is considered only once, i.e. all pairwise distances 
between features are used. Depending on the selected vector 
<b>type</b>, distances are calculated as follows:

<ul>
<li> <b>type=point</b>: point distances are considered;</li>
<li> <b>type=line</b>: line to line distances are considered;</li>
<li> <b>type=area</b>: not supported, use <b>type=centroid</b> instead (and see
	<a href="v.distance.html">v.distance</a> for calculating distances
	between areas)</li>
</ul>

<h2>EXAMPLES</h2>

The examples are based on the North Carolina sample dataset.

<h3>Example dataset preparation</h3>

<div class="code"><pre>
g.region raster=elevation -p
v.random output=samples npoints=100
v.db.addtable map=samples columns="heights double precision"
v.what.rast map=samples rast=elevation column=heights
v.db.select map=samples
</pre></div>

<h3>Calculate height attribute statistics</h3>

<div class="code"><pre>
v.univar -e samples column=heights type=point
    
number of features with non NULL attribute: 100
number of missing attributes: 0
number of NULL attributes: 0
minimum: 57.2799
maximum: 148.903
range: 91.6235
sum: 10825.6
mean: 108.256
mean of absolute values: 108.256
population standard deviation: 20.2572
population variance: 410.356
population coefficient of variation: 0.187123
sample standard deviation: 20.3593
sample variance: 414.501
kurtosis: -0.856767
skewness: 0.162093
1st quartile: 90.531
median (even number of cells): 106.518
3rd quartile: 126.274
90th percentile: 135.023
</pre></div>

<h3>Compare to statistics of original raster map</h3>

<div class="code"><pre>
r.univar -e elevation

total null and non-null cells: 2025000
total null cells: 0

Of the non-null cells:
----------------------
n: 2025000
minimum: 55.5788
maximum: 156.33
range: 100.751
mean: 110.375
mean of absolute values: 110.375
standard deviation: 20.3153
variance: 412.712
variation coefficient: 18.4057 %
sum: 223510266.558102
1st quartile: 94.79
median (even number of cells): 108.88
3rd quartile: 126.792
90th percentile: 138.66
</pre></div>

<h3>Calculate statistic of distance between sampling points</h3>

<div class="code"><pre>
v.univar -d samples type=point

number of primitives: 100
number of non zero distances: 4851
number of zero distances: 0
minimum: 69.9038
maximum: 18727.7
range: 18657.8
sum: 3.51907e+07
mean: 7254.33
mean of absolute values: 7254.33
population standard deviation: 3468.53
population variance: 1.20307e+07
population coefficient of variation: 0.478132
sample standard deviation: 3468.89
sample variance: 1.20332e+07
kurtosis: -0.605406
skewness: 0.238688
</pre></div>

<h2>SEE ALSO</h2>

<em>
<a href="db.univar.html">db.univar</a>,
<a href="r.univar.html">r.univar</a>,
<a href="v.db.univar.html">v.db.univar</a>,
<a href="v.distance.html">v.distance</a>,
<a href="v.neighbors.html">v.neighbors</a>,
<a href="v.qcount.html">v.qcount</a>
</em>


<h2>AUTHORS</h2>

Radim Blazek, ITC-irst
<p>
extended by:<br>
Hamish Bowman, University of Otago, New Zealand<br>
Martin Landa 

<!--
<p>
<i>Last changed: $Date$</i>
-->
